/**
 * Copyright 1998-2006, CHISEL Group, University of Victoria, Victoria, BC, Canada.
 * All rights reserved.
 */
package ca.uvic.cs.cogz.mapping.core;

import java.awt.Color;
import java.util.Collection;

import ca.uvic.cs.cogz.mapping.core.MappingTypeManager.MappingType;
import edu.stanford.smi.protege.model.Frame;
import edu.stanford.smi.protegex.prompt.operation.Operation;

/**
 * Implementation of a suggested/candidate mapping element. This is a mapping that has been found by
 * the mapping algorithm.
 * 
 * @author Sean Falconer
 * @date 10-Jan-07
 */
public class CandidateMapElement extends AbstractMapElement {
	public static final Color LINE_COLOR = Color.RED;
	public static final Color HIGHLIGHT_LINE_COLOR = Color.RED;

	public CandidateMapElement(Operation operation, Collection<Frame> sourcePath, Collection<Frame> targetPath, String annotation) {
		init(operation, sourcePath, targetPath, annotation);
	}

	private void init(Operation operation, Collection<Frame> sourcePath, Collection<Frame> targetPath, String annotation) {
		this.operation = operation;
		this.sourcePath = sourcePath;
		this.targetPath = targetPath;
		this.annotation = annotation;

		this.color = LINE_COLOR;
		this.highlightColor = HIGHLIGHT_LINE_COLOR;
		this.selectedColor = LINE_COLOR;

		this.thickness = DEFAULT_LINE_THICKNESS;
		this.dashed = true;

		Object[] path1 = sourcePath.toArray();
		sourceFrame = (Frame) path1[path1.length - 1];

		Object[] path2 = targetPath.toArray();
		targetFrame = (Frame) path2[path2.length - 1];

		updateStrokeAndPreview();
	}

	public MappingType getMappingType() {
		return MappingType.CANDIDATE_MAPPING;
	}
}
